<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<style type='text/css'>
.table_form tbody td{ border: 1px solid #EEEEEE;}
.division {
    background: none repeat scroll 0 0 #FFFFFF;
    border-color: #CCCCCC #BEC6CE #BEC6CE #CCCCCC;
    border-style: solid;
    border-width: 1px 2px 2px 1px;
    line-height: 150%;
    white-space: normal;
}
.division table {
    margin: 0;
    padding: 0;
}
.division th, .division td {
    border-color: #FFFFFF #DBE2E7 #DDDDDD #FFFFFF;
    border-left: 1px solid #FFFFFF;
    border-right: 1px solid #DBE2E7;
    border-style: solid;
    border-width: 1px;
    padding: 5px;
    vertical-align: top;
}
.division th {
    background: none repeat scroll 0 0 #E2E8EB;
    border-right: 1px solid #CCCCCC;
    font-size: 14px;
    text-align: right;
    white-space: nowrap;
    width: 140px;
}
.gridlist th{
	text-align:center;
	font-weight: bold;
	font-size: 12px;
}
.order_th{font-size: 14px; color: rgb(0, 0, 0); font-weight: bold; margin: 10px;overflow:hidden;}
</style>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('order/order_list');?>' ><em>订单列表</em></a><span>|</span>
        <a href='javascript:;' class="on"><em>添加新订单</em></a>
    </div>
</div>

<div class="pad-10" style="padding-top:0px;">
<?php if($step == 'user'):?>
<form name="myform" id="myform" action="__SELF__" method="post">
<div class="col-tab">
<table width="100%" class="table_form">
	<tbody>
	<tr> 
		<td><input type="radio" checked value="1" name="anonymous"> 匿名用户</td> 
	</tr> 
	<tr> 
		<td><input type="radio" id="user_useridname" value="0" name="anonymous"> 按会员编号或会员名搜索 <input type="text" value="" name="keyword">
  <input type="button" onclick="searchUser();" value=" 搜索 " name="search" class="button">
  <select name="user"></select></td> 
	</tr> 
	<tr> 
		<td><strong>注意：</strong>搜索结果只显示前20条记录，如果没有找到相应会员，请更精确地查找。</td> 
	</tr> 
	</tbody>
</table>
</div>
 <div class="bk15"></div>
    <input name="dosubmit" type="submit" value="提交" class="button">
</form>
<?php elseif($step == 'edit_product'):?>
<table width="100%" class="table_form">
	<tbody>
	<tr> 
		<th>订单号：</th> 
		<td><?php echo $order['order_sn']?></td> 
		<th>下单日期：</th> 
		<td><?php echo date('Y-m-d H:i:s', $order['start_time']);?></td>
	</tr> 

	</tbody>
</table>
<?php endif;?>
</div>
</body>
</html>
<script type="text/javascript">
<!--
function select_area(pid)
{
	$.getJSON('/admin/user/public_area_ajax/pid/'+pid,function(area){
		html = '<option value="0" selected>请选择省份</option>';
		if(area != -1){
			var key = '';
			for(key in area){
				html += '<option value="'+area[key].id+'">'+area[key].name+'</option>';
			}
			$('#province').attr('disabled',false);
		}else{
			$('#province').attr('disabled',true);
		}
		$('#province').html(html);
	});
}
/**
 * 按用户编号或用户名搜索用户
 */
function searchUser()
{
  var eles = document.forms['myform'].elements;

  /* 填充列表 */
  var idName = $.trim(eles['keyword'].value);
  if (idName != '')
  {
//    Ajax.call('order.php?act=search_users&username=' + idName, '', searchUserResponse, 'GET', 'JSON');
    $.getJSON('/admin/order/public_search_user_ajax/username/'+ idName, searchUserResponse);
  }
}

function searchUserResponse(result)
{
  if (result.message.length > 0)
  {
    alert(result.message);
  }

  if (result.error == 0)
  {
    var eles = document.forms['myform'].elements;

    /* 清除列表 */
    var selLen = eles['user'].options.length;
    for (var i = selLen - 1; i >= 0; i--)
    {
      eles['user'].options[i] = null;
    }
    var arr = result.userlist;
    var userCnt = arr.length;

    for (var i = 0; i < userCnt; i++)
    {
      var opt = document.createElement('OPTION');
      opt.value = arr[i].id;
      opt.text = arr[i].username;
      eles['user'].options.add(opt);
    }
  }
}
//-->
</script>
